//
//  SetPasswordVM.swift
//  LeTu
//
//  Created by gy on 2024/1/3.
//

import Foundation

class SetPasswordVM {
    
    /// 设置密码
    func setPassword(password: String, completeHandle: @escaping NetworkRequestHandle) {
        
        apiProvider.request(api: .setPassword(params: ["password": password])) { json, jsonArr, code in
            MYLog("设置密码：",json)
            
            var dialog = DialogMessage()
            
            guard code == 200, let pm = Mapper<ResponseModel>().map(JSON: json) else { return completeHandle(dialog) }
            dialog.code = pm.code
            dialog.message = pm.msg
            completeHandle(dialog)
            
        } failureHandler: { error in
            completeHandle(DialogMessage())
        }
                
    }
    
}
